package com.ecoolex.ying.space.ws;

import java.util.List;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;
import com.ecoolex.ying.space.core.manager.MarktingWholeHouseCaseManager;
import com.ecoolex.ying.space.core.manager.WholeHouseCaseItemsManager;
import com.ecoolex.ying.space.core.manager.WholeHouseCaseManager;
import com.ecoolex.ying.space.entity.MarktingWholeHouseCase;
import com.ecoolex.ying.space.entity.WholeHouseCase;
import com.ecoolex.ying.space.entity.WholeHouseCaseItems;
import com.ecoolex.ying.space.pojo.AddWholeHouseCaseItemsDTO;

@Service
public class WholeHouseCaseServiceImpl implements WholeHouseCaseService{
	
	@Autowired
	private WholeHouseCaseManager wholeHouseCaseManager;

	@Override
	public WholeHouseCase addWholeHouseCase(WholeHouseCase record,List<AddWholeHouseCaseItemsDTO> itemsDTOList, String createUser) {
		return wholeHouseCaseManager.add(record, itemsDTOList, createUser);
	}

	@Override
	public void deleteWholeHouseCase(WholeHouseCase record, String updateUser) {
		wholeHouseCaseManager.delete(record, updateUser);
	}

	@Override
	public void onlineWholeHouseCase(WholeHouseCase record, String updateUser) {
		wholeHouseCaseManager.online(record, updateUser);
	}

	@Override
	public void offlineWholeHouseCase(WholeHouseCase record, String updateUser) {
		wholeHouseCaseManager.offline(record, updateUser);
	}

	@Override
	public WholeHouseCase getWholeHouseCaseById(Integer caseId) {
		return wholeHouseCaseManager.getById(caseId);
	}
	
	@Override
	public WholeHouseCase getWholeHouseCaseByIdForH5(Integer caseId) {
		return wholeHouseCaseManager.getByIdForH5(caseId);
	}


	@Override
	public Pagination<WholeHouseCase> queryWholeHouseCase(Boolean online,String name, Sorting[] sorts, Page page) {
		return wholeHouseCaseManager.query(online,name, sorts, page);
	}
	
	@Autowired
	private WholeHouseCaseItemsManager wholeHouseCaseItemsManager;

	@Override
	public List<WholeHouseCaseItems> getWholeHouseCaseItemsByCaseId(Integer caseId) {
		return wholeHouseCaseItemsManager.getByCaseId(caseId);
	}
	
	@Autowired
	private MarktingWholeHouseCaseManager marktingWholeHouseCaseManager;

	@Override
	public MarktingWholeHouseCase addMarktingWholeHouseCase(MarktingWholeHouseCase record, String createUser) {
		return marktingWholeHouseCaseManager.add(record, createUser);
	}

	@Override
	public void deleteMarktingWholeHouseCase(MarktingWholeHouseCase record, String updateUser) {
		marktingWholeHouseCaseManager.delete(record, updateUser);
	}

	@Override
	public MarktingWholeHouseCase getMarktingWholeHouseCaseById(Integer id) {
		return marktingWholeHouseCaseManager.getById(id);
	}

	@Override
	public Pagination<MarktingWholeHouseCase> queryMarktingWholeHouseCase(String name, Sorting[] sorts, Page page) {
		return marktingWholeHouseCaseManager.query(name, sorts, page);
	}

	@Override
	public Pagination<MarktingWholeHouseCase> queryMarktingWholeHouseCaseForH5(String name,Sorting[] sorts, Page page) {
		return marktingWholeHouseCaseManager.queryOnline(name, sorts, page);
	}

	@Override
	public MarktingWholeHouseCase getMarktingWholeHouseCaseByIdForH5(Integer id) {
		return marktingWholeHouseCaseManager.getOnlineById(id);
	}

	@Override
	public WholeHouseCase editWholeHouseCase(WholeHouseCase record, List<AddWholeHouseCaseItemsDTO> itemsDTOList, String updateUser) {
		return wholeHouseCaseManager.update(record, itemsDTOList, updateUser);
	}

	@Override
	public MarktingWholeHouseCase getMarktingWholeHouseCaseByCaseId(Integer caseId) {
		return marktingWholeHouseCaseManager.getMarktingWholeHouseCaseByCaseId(caseId);
	}

	@Override
	public long countByItemsName(String itemsName) {
		return wholeHouseCaseItemsManager.countByItemsName(itemsName);
	}

	@Override
	public Pagination<String> queryStyleDescriptionByItemsName(String itemsName, Page page) {
		return wholeHouseCaseItemsManager.queryStyleDescriptionByItemsName(itemsName, page);
	}

	@Override
	public Pagination<WholeHouseCaseItems> queryByItemsNameAndStyleDescription(String itemsName, String styleDescription, Page page) {
		return wholeHouseCaseItemsManager.queryByItemsNameAndStyleDescription(itemsName, styleDescription, page);
	}

	@Override
	public WholeHouseCase getWholeHouseCaseByOutsourcingPackagedId(Integer outsourcingPackagedId) {
		return wholeHouseCaseManager.getWholeHouseCaseByOutsourcingPackagedId(outsourcingPackagedId);
	}
}
